<% content_for :main_content do %>
  <div class="row" >
  <section class="panel" id = "basic_material">
    <header class="panel-heading">
      <%= t(".basic_info") %>
    </header>

    <div class="panel-body">
      <%= render 'shared/flash_messages' %>
      <div class="list-group">

        <%= form_for @merchant_info, url: change_info_merchant_merchant_infos_path, method: 'patch' do |f| %>
          <div class="list-group-item">
            <div class="list-group-item-heading">
              <i class="fa fa-book"></i>
              <b> <%= t(".basic_reg_info") %></b>
            </div>
            <table class="table table-bordered">
              <tbody>
              <tr>
                <td><%= t(".name") %></td>
                <td>
                  <%= f.text_field :name, class: "form-control" %>
                  <% unless f.object.errors[:name].blank? %>
                    <span class="error">
                    <%= f.object.errors[:name].join(",")%>
                  </span>
                <% end %>
                </td>
              </tr>
              <tr>
                <td><%= t(".type") %></td>
                <td>
                  <%= f.select :industry,  Category.all.collect { |p| [ p.name, p.name ] },{}, { class: "form-control" } %>
                  <% unless f.object.errors[:industry].blank? %>
                    <span class="error">
                    <%= f.object.errors[:industry].join(",")%>
                  </span>
                <% end %>
                </td>
              </tr>
              <tr>
                <td><%= t(".address") %></td>
                <td>
                  <%= f.text_field :address, class: "form-control"%>
                  <% unless f.object.errors[:address].blank? %>
                    <span class="error">
                    <%= f.object.errors[:address].join(",")%>
                  </span>
                <% end %>
                </td>
              </tr>
              </tbody>
            </table>
          </div>

          <div class="list-group-item">
            <div class="list-group-item-heading">
              <i class="fa fa-pencil"></i>
              <b><%= t(".contact_info") %></b>
            </div>
            <table class="table table-bordered">
              <tbody>
              <tr>
                <td>
                  <%= t(".contact_person_name") %>
                </td>
                <td>
                  <%= f.text_field :contact_person_name, class: "form-control" %>
                  <% unless f.object.errors[:contact_person_name].blank? %>
                    <span class="error">
                    <%= f.object.errors[:contact_person_name].join(",")%>
                  </span>
                <% end %>
                </td>
              </tr>
              <tr>
                <td>
                  <%= t(".contact_way") %>
                </td>
                <td>
                  <%= f.text_field :contact_way, class: "form-control" %>
                  <% unless f.object.errors[:contact_way].blank? %>
                    <span class="error">
                    <%= f.object.errors[:contact_way].join(",")%>
                  </span>
                <% end %>
                </td>
              </tr>
            </table>
          </div>
          <div class="form-group col-md-offset-3 ">
            <%= f.submit t(".change_reg_info"), class: "btn btn-lg btn-primary" %>
          </div>
        <% end %>

          <div class="list-group-item">
            <div class="list-group-item-heading">
              <i class="fa fa-lock"></i>
              <b><%= t(".change_password") %></b>
            </div>
            <%= form_for @merchant, url: update_password_merchant_merchant_infos_path do |f| %>
              <table class="table table-bordered">
              <tbody>
              <tr>
                <td>
                  <%= t(".current_password") %>
                </td>
                <td>
                  <%= password_field_tag :current_password, nil, class: "form-control" %>
                  <% unless f.object.errors[:current_password].blank? %>
                    <span class="error">
                      <%= f.object.errors[:current_password].join(",")%>
                    </span>
                  <% end %>
                </td>
              </tr>
              <tr>
                <td>
                  <%= t(".new_password") %>
                </td>
                <td>
                  <%= f.password_field :password, class: "form-control" %>
                  <% unless f.object.errors[:password].blank? %>
                    <span class="error">
                    <%= f.object.errors[:password].join(",")%>
                  </span>
                <% end %>
                </td>
              </tr>
              <tr>
                <td>
                  <%= t(".new_password_confirm") %>
                </td>
                <td>
                  <%= f.password_field :password_confirmation, class: "form-control" %>
                  <% unless f.object.errors[:password_confirmation].blank? %>
                    <span class="error">
                    <%= f.object.errors[:password_confirmation].join(",")%>
                  </span>
                <% end %>
                </td>
              </tr>
              </tbody>
            </table>
            <div class="form-group col-md-offset-3" >
              <%= f.submit t(".change_password"), class: "btn btn-lg btn-primary" %>
            </div>
          <% end %>
          </div>
        </div> <!-- list-group -->
      </div> <!-- panel-body -->
    </section>
  </div>
<% end %>
